<%@ page language="java" contentType="text/html; charset=gbk" pageEncoding="UTF-8"%>
<%@page import="java.io.*,com.base.commons.SpringBeanHolder,com.base.attachment.service.IAttachmentDAO"%>
<%@page import="com.base.attachment.entity.*,com.base.attachment.service.IAttachmentStorer"%>
<%@page import="javax.imageio.ImageIO" %>
<%@page import="com.process.drawImage.*" %>
<%
	String beanId = request.getParameter("beanId");
	IAttachmentDAO attachmentDAO = SpringBeanHolder
			.getBean("attachmentDAO");
	Attachment attach = attachmentDAO.get(beanId);
	IAttachmentStorer attachmentStorer = SpringBeanHolder
			.getBean("attachmentStorer");
	InputStream is = attachmentStorer.downloadAttachment(attach);

    JpdlModel jpdlModel = new JpdlModel(is);
	File file = new File("test.png");
	ImageIO.write(new JpdlModelDrawer().draw(jpdlModel), "png", file);

   InputStream io=new FileInputStream(file);
	byte[] b = new byte[1024];
	int len = -1;
	while ((len = io.read(b, 0, 1024)) != -1) {
		response.getOutputStream().write(b, 0, len);

	}
	out.clear();
	out = pageContext.pushBody();
%>